<html>
<head>
<h1>View Transactions</h1>
</head>
<body>
<?php
	require "configcmd.php"; 
	$con = mysql_connect("localhost",$db_user ,$db_pass);
	if (!$con){
		die('Could not connect: ' . mysql_error());
    }
	mysql_select_db($db_name, $con);
	$sql_fetch = "Select * from transactions";
	$result = mysql_query($sql_fetch); 

	if(!$result){
		die("database query failed: " . mysql_error());
	} 

?>

<table border='1'>
<tr> 
<td><b>Transaction ID</b></td>
<td><b>Account ID</b></td>
<td><b>Amount Charged</b></td>
<td><b>Date</b></td>
<td><b>Description</b></td>
</tr>
<?php while($row = mysql_fetch_array($result)){
	echo "<tr>";
	echo "<td>" . $row["TransactionID"] . "</td>";
	echo "<td>" . $row["AccountID"] . "</td>";
	echo "<td>" . $row["Charge"] . "</td>";
	echo "<td>" . $row["Date_Charge"] . "</td>";
	echo "<td>" . $row["Description"] . "</td>";
	echo "<td><form method='POST' name='updateForm' action='edittransaction.php'>
	<input type='hidden' name= 'TransactionID' value=".$row['TransactionID'].">
	<input type='submit' name='Edit' value='Edit'> 
   </form></td>";

	echo "</tr>";
}
	mysql_close($con);?>
</table>
<a href="main.php">Home</a>
</body>
</html>
